package hu.myai.indicators.tick;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import hu.myai.api.indicators.AbstractIndicator;
import hu.myai.model.IndicatorVO;

public class TickColorIndicator extends AbstractIndicator {

	/**
	 * The object used when logging debug,errors,warnings and info.
	 * */
	private final Logger log = LoggerFactory.getLogger(this.getClass());

	public TickColorIndicator() {
		super(0.0);
	}

	private int counter;
	@Override
	protected IndicatorVO indicatorCalculation() {

		if(lastTick.getCenterOfGravity() < lastTick.getPivot())
			counter++;
		else
			counter--;

		IndicatorVO indicator = new IndicatorVO();
		indicator.setValue(counter * 0.0004 + 1.38);
		indicator.setChanged(true);
		indicator.setDate(lastTick.getTime());

		log.debug(indicator.toString());
		return indicator;
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}
}
